Skip to content

fix(android): clip children to the rounded corners and draw the border over them - #17

Merged
farfromrefug merged 1 commit into
mainfrom
fix/android-clip-children-rounded-border
Nov 14, 2026
Merged

farfromrefug merged 1 commit into
mainfrom
fix/android-clip-children-rounded-border

Conversation

@farfromrefug

Copy link
Copy Markdown

What is the current behavior?

On Android a view with a border and a border radius draws its border as a BorderDrawable background and clears the outline. Its children are not clipped, so a square child (e.g. an image) pokes out of the rounded corners and covers the border there. iOS already clips children to the rounded layer and draws the border on top.

What is the new behavior?

When the view has a border radius (no box shadow, no clip path, uniform radii below Android 13) the outline clips the children to the rounded corners.
With a border width, the background BorderDrawable draws only the fill (refreshBorderDrawable(view, drawable, 'background')) and a second BorderDrawable draws only the border ('border') as the view foreground, over the children. Needs API 23 for the foreground, API 21 without a border width. No native change.

Manual test (no unit test: native Android drawing): a GridLayout with borderRadius, borderWidth and an Image child. Checked on an Android emulator: the image is clipped to the corner and the border is drawn over it.

Not covered here: other views with a radius and a border holding children now clip on Android; worth a glance in apps/automated.

🤖 Generated with Claude Code

…r over them

A view with a border and a border radius used a BorderDrawable as its
background and cleared the outline: its children were not clipped and drew
over the corners of the border (a square child poked out of a rounded view).

When the view has a border radius (no box shadow, no clip path) the outline
now clips the children to the rounded corners. With a border width, the
background drawable draws only the fill and a second BorderDrawable draws
only the border as the foreground, over the children.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@farfromrefug
farfromrefug marked this pull request as ready for review November 14, 2026 09:10
@farfromrefug
farfromrefug merged commit a075132 into main Nov 14, 2026
0 of 2 checks passed
@farfromrefug
farfromrefug deleted the fix/android-clip-children-rounded-border branch November 14, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant